package _org;

import w3c.Viewer;

public class DumbBrowser {
	
	private Viewer viewer;
	public DumbBrowser(Viewer viewer) {
		System.out.println("DumbBrowser > .");
		this.viewer = viewer;
	}
	
	public void navigate(DagElement root) {
		System.out.println("DumbBrowser > navigate");
		//System.out.println(root);
		visit(root);
	}

	private void visit(DagElement e) {
		//System.out.println("DumbBrowser > visit");
		
		viewer.doview(e);
		
		// recursion. stop it when there is a feaf with no childs
		for(DagElement child : e.childs) {
			visit(child);
		}
	}
}
